package com.diqizu.servlet;
import java.io.IOException;




import java.util.ArrayList;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.diqizu.dao.ChanPinDaoImpl;
import com.diqizu.dao.DisPlayDaoImpl;
import com.diqizu.dao.GonSiDaoImpl;
import com.diqizu.dao.JxinFoDaoImpI;

import com.diqizu.dao.LunBoDaoImpl;
import com.diqizu.entity.ChanPininof;
import com.diqizu.entity.DisPlay;
import com.diqizu.entity.GongSi;
import com.diqizu.entity.JxinFo;

import com.diqizu.entity.LunBo;

/**
 * ��ַ��localhost:8080/DiQiZu/HomeServlet?method=toIndex
 * ��������������תҳ�� 
 */
@WebServlet("/HomeServlet")
public class HomeServlet extends BaseServlet {
	public void toIndex(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// 轮播图信息
		LunBoDaoImpl dao = new LunBoDaoImpl();
		ArrayList<LunBo> aLlEmp = dao.getALllb();
		// 公司信息
		GonSiDaoImpl dao2 = new GonSiDaoImpl();
		GongSi aLlgs1 = dao2.getALlgs();
		// 产品信息
		ChanPinDaoImpl dao3 = new ChanPinDaoImpl();
		ArrayList<ChanPininof> aLlgs2 = dao3.getALlcp();
		// 精选信息
		//精选
		JxinFoDaoImpI dao5 = new JxinFoDaoImpI();
		ArrayList<JxinFo> aLlgs4 = dao5.getALljxinfo();
		//存储作用域
		DisPlayDaoImpl dao4=new DisPlayDaoImpl();
		ArrayList<DisPlay> aLlEmp2 = dao4.DisPlay();
		req.setAttribute("aLlEmp", aLlEmp);
		req.setAttribute("aLlEmp2", aLlEmp2);
		req.setAttribute("aLlgs2", aLlgs2);
		req.setAttribute("aLlgs4", aLlgs4);
		HttpSession session = req.getSession();
		session.setAttribute("aLlgs1", aLlgs1);
		

		//跳转
		req.getRequestDispatcher("index.jsp").forward(req, resp);
	}
}